﻿@model LawProject.Models.BanTinContract

@{
    ViewBag.Title = "ChiTietBanTin";
    Layout = "~/Views/Shared/AdminLayout.cshtml";
}
   <script src="@Url.Content("~/Content/ckeditor/ckeditor.js")" type="text/javascript"></script>
   <script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.js")" type="text/javascript"></script>
<style>
    .textboxedit
    {
        width:540px;
    }
    .divtextbox
    {
        margin:5px;
    }
</style>
<h2>---Chi tiết bản tin</h2>
@using (Html.BeginForm("BanTinUpdate", "Admin", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
            @Html.ValidationSummary(true)
             <div id="hiddenMaBanTin">
            @Html.HiddenFor(model => model.ChiTiet.MaBanTin)
            </div>
            <div id="hiddenMaLinhVuc">
            @Html.HiddenFor(model => model.ChiTiet.MaThuMucCha)
            </div>
             <div id="hiddenNoiDungVN">
            @Html.HiddenFor(model => model.ChiTiet.NoiDung)
            </div>
            <div id="hiddenNoiDungEN">
            @Html.HiddenFor(model => model.ChiTiet.NoiDungEN)
            </div>
            <div>Tiêu đề tiếng Việt</div>
            <div id="hiddenType" class="divtextbox" style="width:540px;">
                @Html.TextBoxFor(model => model.ChiTiet.TieuDe, new { @class = "textboxedit" })
            </div>
                @*<div>Tóm tắt tiếng Việt</div>
            <div class="divtextbox" style="width:540px;">
                @Html.TextBoxFor(model => model.ChiTiet.TomTat, new { @class = "textboxedit" })
            </div>*@
            <div class="divtextbox" style="width:540px;">
                <textarea class="ckeditor" id="editor1" rows="10" style="width:540px; height:300px; overflow-x:hidden;"></textarea>
            </div>
             
             <div>Tiêu đề tiếng Anh</div>
            <div class="divtextbox" style="width:540px;">
                @Html.TextBoxFor(model => model.ChiTiet.TieuDeEN, new { @class = "textboxedit" })
            </div>
                @*<div>Tóm tắt tiếng Anh</div>
            <div class="divtextbox" style="width:540px;">
                @Html.TextBoxFor(model => model.ChiTiet.TomTatEN, new { @class = "textboxedit" })
            </div>*@
            <div class="divtextbox" style="width:540px;">
                <textarea class="ckeditor" id="editor2" rows="10" style="width:540px; height:300px; overflow-x:hidden;"></textarea>
            </div>
              
               <div style="position:relative; text-align:center; width:540px;">
                <input id="submit" type="submit" value="Lưu thông tin"/>
               </div>
        
}
<h2>---Danh sách bản tin con</h2>
<div style="height:auto; overflow:hidden;">
@foreach (var item in Model.ListData)
{

    <div style="position:relative; float:none; border-bottom: 1px solid red; overflow:hidden;">
    <div style="width:30px; float:left; position:relative; padding:5px;">
    @Html.ActionLink("Xóa", "BanTinConDelete", new { mabtc = item.MaBanTinCon }, new { @class = "context_link" })
    </div>
    <div style="float:left; position:relative;" class="div_panel">@Html.ActionLink(item.Title, "ChiTietBanTinCon", new { mabtc = item.MaBanTinCon }, new { @class = "link_menu" })</div>
    </div>
    <br />
}
</div>
<div style="width:80px; position:relative;">
    @Html.ActionLink("Tạo mới", "BanTinConCreate", new { mabt = Model.ChiTiet.MaBanTin }, new { @class = "context_link" })
</div>
<script type="text/javascript">
    $(document).ready(function () {
        $("#submit").click(function () {
            var value1 = CKEDITOR.instances['editor1'].getData();
            var value2 = CKEDITOR.instances['editor2'].getData();
            $("#hiddenNoiDungVN > input").val(value1);
            $("#hiddenNoiDungEN > input").val(value2);

        })
    })
    $(window).load(function () {
        CKEDITOR.instances['editor1'].setData($("#hiddenNoiDungVN > input").val());
        CKEDITOR.instances['editor2'].setData($("#hiddenNoiDungEN > input").val());
    });
         
        
</script>
